package com.doge.walknovel.widgets.imagecropper

object ImageCropperHelper {
    var viewCropper: ImageCropper? = null

    // 静态view引用方便获取
    fun startCrop(viewCropper: ImageCropper) {
        ImageCropperHelper.viewCropper = viewCropper
    }

    // 全局结束裁剪
    fun overCrop() {
        viewCropper = null
    }

    fun tryCloseCropper(): Boolean {
        val cropper = viewCropper ?: return false
        return cropper.handleBackPressed().also { viewCropper = null }
    }
}